<template>
	<view>
		<image :src="imgUrl" @click="previewImg" class="image" mode="widthFix"></image>
	</view>
</template>

<script>
	import { getPoster } from "@/api/user.js"
	export default {
		data() {
			return {
				// uid: '',
				imgUrl: ''
			}
		},
		onLoad(options) {
			console.log(options)
			this.uid = uni.getStorageSync("userId");
			this.getImg();
		},
		methods: {
			getImg(){
				getPoster({
					uid: this.uid
				}).then(res => {
					if(res.errno == 0){
						console.log(res,'kkkk')
						this.imgUrl = res.data;
					}
					
				})
			},
			// 预览图片
			previewImg(){
				uni.previewImage({
						current: 0,
						urls: [this.imgUrl],
						longPressActions: true
					})
			}
		}
	}
</script>

<style>
	.image {
		width: 100%;
	}

</style>
